{extend name="public/base" /}
{block name="title"}
<title>{:confv('title')}</title>
<meta name="keywords" content="{:confv('keywords')}">
<meta name="description" content="{:confv('description')}">
{/block}
{block name="head"}
<link href="__ROOT__/home/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
<link href="__ROOT__/home/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

<link href="__ROOT__/home/css/personal.css" rel="stylesheet" type="text/css">
<link href="__ROOT__/home/css/infstyle.css" rel="stylesheet" type="text/css">
<script src="__ROOT__/home/AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
<script src="__ROOT__/home/AmazeUI-2.4.2/assets/js/amazeui.js"></script>	
<script src="__ROOT__/home/js/layer/layer.js"></script>
{/block}
{block name="body"}
    <div class="nav-table">
			   <div class="long-title"><span class="all-goods">全部分类</span></div>
			   <div class="nav-cont">
					<ul>
						{foreach $cates as $vo}
	                        <li class="qc"><a href="{:url('/'.$vo['id'])}">{$vo.typename}</a></li>
					    {/foreach}
					</ul>
				 
				</div>
	</div>
	<b class="line"></b>
<div class="center">
	<div class="col-main">
		<div class="main-wrap">

			<div class="user-info">
				<!--标题 -->
				<div class="am-cf am-padding">
					<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">个人资料</strong> / <small>Personal&nbsp;information</small></div>
				</div>
				<hr/>

				<!--头像 -->
				<div class="user-infoPic">
                    
					<div class="filePic">
						<input type="file" class="inputPic" allowexts="gif,jpeg,jpg,png,bmp" accept="image/*" id="avatar" onchange="upload()">
						<img class="am-circle am-img-thumbnail" src="{$user.avatar | default='__ROOT__/home/images/getAvatar.do.jpg'}" alt="" />
					</div>

					<p class="am-form-help">头像</p>

					<div class="info-m">
						<div><b>用户名：<i>{$user.username}</i></b></div>
						<div class="vip">
                              <span></span><a href="#">会员专享</a>
						</div>
					</div>
				</div>

				<!--个人信息 -->
				<div class="info-main">
					<form class="am-form am-form-horizontal" action="{:url('eidt')}" method="post">

						<!-- <div class="am-form-group">
							<label for="user-name2" class="am-form-label">昵称</label>
							<div class="am-form-content">
								<input type="text" id="user-name2" placeholder="nickname">
                                  <small>昵称长度不能超过40个汉字</small>
							</div>
						</div> -->

						<div class="am-form-group">
							<label for="user-name" class="am-form-label">姓名</label>
							<div class="am-form-content">
								<input type="text" id="user-name2" placeholder="name" value="{$user.name}" name="name">
                                 
							</div>
						</div>

						<div class="am-form-group">
							<label class="am-form-label">性别</label>
							<div class="am-form-content sex">
								<label class="am-radio-inline">
									<input type="radio" name="sex" value="1" data-am-ucheck {eq name="$user['sex']" value="1"}checked{/eq}> 男
								</label>
								<label class="am-radio-inline">
									<input type="radio" name="sex" value="2" data-am-ucheck {eq name="$user['sex']" value="2"}checked{/eq}> 女
								</label>
							</div>
						</div>
						<div class="am-form-group">
							<label for="user-phone" class="am-form-label">电话</label>
							<div class="am-form-content">
								<input id="user-phone" placeholder="telephonenumber" type="tel" value="{$user.moblie}" name="moblie">

							</div>
						</div>
						<div class="am-form-group">
							<label for="user-email" class="am-form-label">电子邮件</label>
							<div class="am-form-content">
								<input id="user-email" placeholder="Email" type="email" value="{$user.email}" name="email">

							</div>
						</div>
						<div class="am-form-group">
							<label for="user-phone" class="am-form-label">身份证号</label>
							<div class="am-form-content">
								<input id="user-phone" placeholder="idcard" type="tel" value="{$user.idcard}" name="idcard">

							</div>
						</div>
						<input type="hidden" name="avatar" id='useravatar'>
						<div class="info-btn">
							<div class="am-btn am-btn-danger">保存修改</div>
						</div>

					</form>
				</div>

			</div>

		</div>
		<!--底部-->
		{block name="foot"}{include file="public/footer" /}{/block}
	</div>

	<aside class="menu">
		<ul>
			<li class="person active">
				<a href="index.html"><i class="am-icon-user"></i>个人中心</a>
			</li>
			<li class="person">
				<ul>
					<li> <a href="{:url('/member')}">个人信息</a></li>
					<li> <a href="{:url('/myorder')}">订单详情</a></li>
					<li> <a href="{:url('/myscore')}">我的积分</a></li>
					<li> <a href="{:url('/mylong')}">消费详情</a></li>
					<li> <a href="{:url('/subordinate')}">会员信息</a></li>
					<!-- <li> <a href="safety.html">安全设置</a></li>
					<li> <a href="address.html">地址管理</a></li>
					<li> <a href="cardlist.html">快捷支付</a></li> -->
				</ul>
			</li>

		</ul>

	</aside>
</div>
<script src="__ROOT__/home/js/jquery.ui.widget.js"></script>
<script src="__ROOT__/home/js/jquery.iframe-transport.js"></script>
<script src="__ROOT__/home/js/jquery.fileupload.js"></script>
<script type="text/javascript">
$('.am-btn').click(function(e){
	e.preventDefault();
	var form = $('.am-form-horizontal');
	var formData = form.serialize();

	$.post('{:url('/edit')}',formData,function(data){
		if (data.status==1) {
			layer.msg(data.info);
			window.setTimeout(function(){
				window.location.reload();
			},1000)
		}else{
            layer.msg(data.info);
		}
         
	})
})

function upload() {
	$('#avatar').fileupload({
        dataType: 'json',
        url:"{:url('/upload')}",
        done: function (e, data) {
        	// alert(data.result.status)
        	if (parseInt(data.result.status)==1) {
        		$('.am-img-thumbnail').attr('src',data.result.url);
        		$('#useravatar').val(data.result.url);
        	}
            // $.each(data.result.files, function (index, file) {
            //     $('<p/>').text(file.name).appendTo(document.body);
            // });
        }
    });
}
</script>
{/block}